import { Spin } from 'antd'
import type { SpinSize } from 'antd/es/spin'

type LoadingOverlayProps = {
  message?: string
  size?: SpinSize
}

const overlayStyle: React.CSSProperties = {
  minHeight: '60vh',
  display: 'flex',
  flexDirection: 'column',
  alignItems: 'center',
  justifyContent: 'center',
  gap: 16,
}

const LoadingOverlay = ({ message = '加载中...', size = 'large' }: LoadingOverlayProps) => {
  return (
    <div style={overlayStyle}>
      <Spin size={size} />
      {message ? <span>{message}</span> : null}
    </div>
  )
}

export default LoadingOverlay


